//
//  ZYXCommen.h
//  ZYXApp
//
//  Created by 梁炜东 on 2017/4/1.
//  Copyright © 2017年 梁炜东. All rights reserved.
//

#ifndef ZYXCommen_h
#define ZYXCommen_h

//公共model单例对象
#define publicModel   [YTPublicModel shareModel]
//设备单列对象
#define deviceManager [YTCameraManager shareModel]

//发送指令单例对象
#define cmdManager [YTCmdSocketManager shareToolManager]

//屏幕的宽、高
#define ScreenWidth   [UIScreen mainScreen].bounds.size.width
#define ScreenHeight  [UIScreen mainScreen].bounds.size.height

//背景颜色
#define YTColor(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1.0]
#define YTColorAlpha(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:a]

//定义UIImage对象
#define IMAGE(imageName) [UIImage imageNamed:[NSString stringWithFormat:@"%@",imageName]]

// Notification center //通知中心
#define NOTIFICATION_CENTER [NSNotificationCenter defaultCenter]

// 系统相关信息
#define SYSTEM_MODEL (([[UIDevice currentDevice] model]))
#define SYSTEM_VERSION ([[UIDevice currentDevice] systemVersion])

// 定义UserDefaults
#define UserDefaults        [NSUserDefaults standardUserDefaults]

//沙盒文件管理对象
#define FileManager         [NSFileManager defaultManager]

//
#define SharedApplication   [UIApplication sharedApplication]

#define APP_Delegate (AppDelegate *)SharedApplication.delegate

// KeyWindow
#define KeyWindow           [UIApplication sharedApplication].keyWindow
#define kRootController     KeyWindow.rootViewController
/**
 事件处理签名
 */

typedef void(^EventHandler)(id sender);

typedef void(^EventVoidHandler)(void);

typedef void(^EventTwoHandler)(id sender,id sender1);

typedef void(^RightActionBlock)(id sender,id sender1);

typedef void(^EventThreeHandler)(id sender,id sender1,id sender2);
/**
 调用一个block,会判断block不为空
 */
#define BlockCallWithVoidArg(block)  if(block){block();}

/**
 调用一个block,会判断block不为空
 */
#define BlockCallWithOneArg(block,arg)  if(block){block(arg);}
#define BlockCallWithOneCompeteSEL(block,arg,SEL)  if(block){block(arg); [self performSelector:SEL withObject:nil];}

/**
 调用一个block,会判断block不为空
 */
#define BlockCallWithTwoArg(block,arg1,arg2) if(block){block(arg1,arg2);}
/**
 调用一个block,会判断block不为空
 */
#define BlockCallWithThreeArg(block,arg1,arg2,arg3) if(block){block(arg1,arg2,arg3);}

/**
 申明一个 block_self 的指针，指向自身，以用于在block中使用
 */
#if __has_feature(objc_arc)
#define IMP_BLOCK_SELF(type) __weak type *block_self=self;
#else
#define IMP_BLOCK_SELF(type) __block type *block_self=self;
#endif


//国际化
#define Language(key) NSLocalizedString(key, nil)

//字体
#define CUSTOM_BODY_FONT @"FZLTHJW--GB1-0" //方正兰亭黑

#define SafeAreaBottomHeight (ScreenHeight == 812.0 ? 34 : 0)

// 视频本地存储路径
//#define kVideoPath NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).lastObject
#define kVideoPath [NSString stringWithFormat:@"%@/camera/Video/", NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).lastObject]
// 照片本地存储路径
//#define kPhotoPath NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).lastObject
#define kPhotoPath [NSString stringWithFormat:@"%@/camera/Photo/", NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).lastObject]


#endif /* ZYXCommen_h */
